home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / RESET_SH.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  70 lines

  1. #include <string.h>
  2. #define        CURSES_LIBRARY  1
  3. #include <curses.h>
  4. #undef reset_shell_mode
  5.  
  6. #ifndef NDEBUG
  7. char *rcsid_reset_sh = "$Header: c:/curses/portable/RCS/reset_sh.c%v 2.0 1992/11/15 03:29:12 MH Rel $";
  8. #endif
  9.  
  10.  
  11.  
  12.  
  13. /*man-start*********************************************************************
  14.  
  15.   reset_shell_mode()   - restore terminal mode
  16.  
  17.   X/Open Description:
  18.        Restore the terminal to "program" (in curses) or "shell" (out
  19.        of curses) state.  These are done automatically by endwin()
  20.        and doupdate() after an endwin(), so they would normally not
  21.        be called before these functions.
  22.  
  23.   PDCurses Description:
  24.        Under the Flexos platform, PDCurses operates in 16-bit mode.
  25.        Normally, the Flexos shell operates in 8-bit mode.
  26.  
  27.   X/Open Return Value:
  28.        The reset_shell_mode() routine returns OK on success otherwise ERR
  29.        is returned.
  30.  
  31.   Portability:
  32.        PDCurses        int reset_shell_mode( void );
  33.        X/Open Dec '88  int reset_shell_mode( void );
  34.        SysV Curses     int reset_shell_mode( void );
  35.        BSD Curses      int reset_shell_mode( void );
  36.  
  37. **man-end**********************************************************************/
  38.  
  39. int    reset_shell_mode(void)
  40. {
  41.        if      (c_sh_tty.been_set == TRUE)
  42.        {
  43. #if    defined(DOS) || defined(OS2)
  44. #  if  SMALL || MEDIUM
  45.        movedata( FP_SEG(&c_sh_tty.saved),              FP_OFF(&c_sh_tty.saved),
  46.                  FP_SEG(&_cursvar),    FP_OFF(&_cursvar),
  47.                  sizeof(SCREEN) );
  48. #  else
  49.                memcpy(&_cursvar, &c_sh_tty.saved, sizeof(SCREEN));
  50. #  endif
  51. #endif
  52.                mvcur(0, 0, c_sh_tty.saved.cursrow, c_sh_tty.saved.curscol);
  53.                if (PDC_get_ctrl_break() != c_sh_tty.saved.orgcbr)
  54.                        PDC_set_ctrl_break(c_sh_tty.saved.orgcbr);
  55.                if (c_sh_tty.saved.raw_out)
  56.                        raw();
  57.                if (c_sh_tty.saved.visible_cursor)
  58.                        curson();
  59.                _cursvar.font = PDC_get_font();
  60.                PDC_set_font(c_sh_tty.saved.font);
  61.                if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(),  c_sh_tty.saved.scrnmode))
  62.                        PDC_set_scrn_mode(c_sh_tty.saved.scrnmode);
  63.                PDC_set_rows(c_sh_tty.saved.lines);
  64.        }
  65. #ifdef FLEXOS
  66.        _flexos_8bitmode();
  67. #endif
  68.        return( OK );
  69. }
  70.